Skip to content

(GH-1393) Rename --version to --required-version for resource commands - #1610

Open
michaeltlombardi wants to merge 1 commit into
PowerShell:mainfrom
michaeltlombardi:gh-1393/main/require-version-cli-fields
Open

(GH-1393) Rename --version to --required-version for resource commands#1610
michaeltlombardi wants to merge 1 commit into
PowerShell:mainfrom
michaeltlombardi:gh-1393/main/require-version-cli-fields

Conversation

@michaeltlombardi

Copy link
Copy Markdown
Collaborator

PR Summary

This change:

PR Context

Prior to this change, the dsc resource * subcommands used the --version flag to specify the version requirement for the resource that the command invokes. The option accepts a string which it parses into a ResourceVersionReq instance.

The name of the option was misleading, as it implied that the user should specify a specific version, like 1.2.3, when this would actually parse as the version requirement ^1.2.3, which would match any version >=1.2.3 <2.0.0.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the dsc resource * CLI surface to use --required-version (instead of --version) for specifying a resource version requirement, aligning the flag name with its actual semantics and addressing #1393.

Changes:

  • Renames the resource subcommand argument field from version to required_version, producing a --required-version long flag.
  • Updates the resource subcommand dispatcher match arms to bind required_version as version for downstream calls.
  • Adds --version as a backwards-compatibility alias (currently implemented as a visible alias).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
dsc/src/args.rs Renames the version option to required_version and adds --version aliasing for resource subcommands.
dsc/src/subcommand.rs Updates match patterns for ResourceSubCommand::* to use required_version bindings.

Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/args.rs Outdated
Comment thread dsc/src/subcommand.rs Outdated
@michaeltlombardi
michaeltlombardi force-pushed the gh-1393/main/require-version-cli-fields branch 2 times, most recently from 31789f0 to 0320aa6 Compare July 7, 2026 18:48
@michaeltlombardi
michaeltlombardi marked this pull request as ready for review July 7, 2026 18:58
Copilot AI review requested due to automatic review settings July 20, 2026 18:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

Comment thread dsc/src/args.rs
Comment thread dsc/src/args.rs
Comment thread dsc/src/args.rs
Comment thread dsc/src/args.rs
Comment thread dsc/src/args.rs
Comment thread dsc/src/args.rs
…source commands

Prior to this change, the `dsc resource *` subcommands used the
`--version` flag to specify the version requirement for the resource
that the command invokes. The option accepts a string which it parses
into a `ResourceVersionReq` instance.

The name of the option was misleading, as it implied that the user
should specify a specific version, like `1.2.3`, when this would
actually parse as the version requirement `^1.2.3`, which would match
any version `>=1.2.3 <2.0.0`.

This change:

- Renames the `--version` option to `--required-version` to
better reflect the semantics and minimize confusion.
- Retains the short option `-v` and aliases the long option `--version`
  for backward compatibility.
- Fixes PowerShell#1393
Copilot AI review requested due to automatic review settings July 29, 2026 21:39
@michaeltlombardi
michaeltlombardi force-pushed the gh-1393/main/require-version-cli-fields branch from a686994 to 039a009 Compare July 29, 2026 21:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

dsc/src/args.rs:232

  • The new user-facing flag name --required-version isn’t currently exercised by tests. Existing PowerShell CLI tests still use --version, which will continue to pass via the alias, but won’t catch regressions where --required-version stops being recognized (e.g., due to a future clap-derive attribute change). Add/adjust at least one resource command test to use --required-version (and optionally keep one test validating --version remains accepted for back-compat).
        #[clap(short = 'v', long, alias = "version", help = t!("args.version").to_string())]
        required_version: Option<ResourceVersionReq>,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename version field for dsc resource * commands to required_version

4 participants